package com.shujia.wyh.day28;

public class Person {
    //成员变量
    private String name;
    int age;
    protected String address;
    public String id;

    //构造方法
    public Person() {

    }

    public Person(String name) {
        this.name = name;
    }

    private Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    protected Person(String name, int age, String address) {
        this.name = name;
        this.age = age;
        this.address = address;
    }

    //成员方法
    public void fun1(){
        System.out.println("这是公共的fun1方法");
    }
    private void fun2(String s){
        System.out.println("这是私有的带参数的fun2方法");
    }
    protected void fun3(){
        System.out.println("这是被保护的fun3方法");
    }
    void fun4(){
        System.out.println("这是默认修饰符的fun4方法");
    }

    public void eat(String s){
        System.out.println("这是公共的吃方法");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", address='" + address + '\'' +
                ", id='" + id + '\'' +
                '}';
    }
}
